import { Routes, RouterModule } from "@angular/router";
import { UserListComponent } from "./user-list/user-list.component";
import { UserFormComponent } from "./user-form/user-form.component";
import { NgModule } from "@angular/core";
import { UserGuard } from "./user.guard";
import { UserTestComponent } from "./user-test/user-test.component";


const routes : Routes = [
    {
        path: "",
        redirectTo: "userList",
        pathMatch: "full"
    },
    {
        path: "userList",
        canDeactivate: [UserGuard],
        component: UserListComponent,
        children: [
            {
                path: "userTest",
                component: UserTestComponent
            }
        ]
    },
    {
        path: "userForm",
        component: UserFormComponent
    }
]
@NgModule({
    imports: [RouterModule.forChild(routes)],
    providers: [UserGuard]
})
export class UserRoutes {}